import { ColumnProps } from '~/library/components/ProTable/interface'
import { Procure } from '~/src/api/interface/procure'
import { formatDate } from '~/src/utils/date-formatter'
import { detailTypeNameType, stockSPlanStatus } from '~/src/utils/serviceDict'

export const stockPlanColumn: ColumnProps<Procure.StockPlan>[] = [
  {
    type: 'index',
    label: '序号',
    width: 60,
    search: {
      el: 'date-picker',
      label: '单据日期',
      key: 'date',
      defaultValue: [formatDate(-30, 'start', 'yyyy-MM-dd'), formatDate(0, 'end', 'yyyy-MM-dd')],
      order: 1,
      props: {
        type: 'datetimerange',
        format: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD',
      },
    },
  },
  {
    sortable: true,
    prop: 'orderNo',
    label: '单据号',
    width: 250,
    // search 配置是否可以通过上面搜索框搜索到数据
    search: {
      el: 'input',
    },
  },
  // {
  //       sortable: true,prop: "planType",
  //   enum: stockSPlanScope,
  //   label: "盘点范围"
  // },
  {
    sortable: true,
    prop: 'status',
    enum: stockSPlanStatus,
    label: '盘点状态',
    search: {
      el: 'select',
    },
  },
  {
    sortable: true,
    prop: 'createTime',
    label: '创建日期',
  },
  {
    sortable: true,
    prop: 'houseName',
    label: '仓库',
  },
  {
    sortable: true,
    prop: 'sysUserName',
    label: '创建人',
  },
  {
    sortable: true,
    prop: 'checkerName',
    label: '审核人',
  },
  {
    sortable: true,
    prop: 'checkTime',
    label: '完成时间',
  },
  {
    sortable: true,
    prop: 'remark',
    label: '备注',
  },
  {
    prop: 'operation',
    label: '操作',
  },
]

export const stockPlanAddColumn: ColumnProps<Procure.StockPlan>[] = [
  { type: 'index', label: '序号', width: 60 },
  { prop: 'operate', label: '操作', width: 100 },
  { prop: 'barcode', label: '编码', minWidth: 200 },
  { prop: 'name', label: '名称', minWidth: 140 },
  { prop: 'categoryName', label: '分类名称', minWidth: 120 },
  { prop: 'productName', label: '规格', minWidth: 100 },
  { prop: 'quantity', label: '账面数量', minWidth: 80 },
  { prop: 'costAmount', label: '账面金额', minWidth: 80 },
  { prop: 'price', label: '成本价', minWidth: 80 },
  { prop: 'unitName', label: '单位', minWidth: 80 },

  // { prop: "categoryName", label: "商品分类", minWidth: 80 },
  { prop: 'realQuantity', label: '实盘数量', minWidth: 80 },
  { prop: 'realAmount', label: '实盘金额', minWidth: 80 },
  { prop: 'profitLossQuantity', label: '盈亏数量', minWidth: 80 },
  { prop: 'profitLossAmount', label: '盈亏金额', minWidth: 80 },
  {
    prop: 'detailType',
    label: '盘点结果',
    enum: detailTypeNameType,
    minWidth: 80,
  },
]
